{% extends 'base.html' %}
{% load humanize %}
{% block page-content %}
{% include 'nav_cat_bar.html' %}
{% load mytags %}

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>游戏服备份状态</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="#">未启用 1</a>
                            </li>
                            <li><a href="#">未启用 2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <div class="table-responsive">
                    <div id="txtHint">
                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th class="text-center">平台</th>
                                <th class="text-center">服务器地址</th>
                                <th class="text-center">服务器名</th>
                                <th class="text-center">数据库IP</th>
                                <th class="text-center">开始时间</th>
                                <th class="text-center">备份进度</th>
                                <th class="text-center">日志</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for num in menu %}
                                <tr class="text-center">
                                    <td>{{num.platform}}</td>
                                    <td>{{num.p_ip}}</td>
                                    <td>
                                        {{num.server_name}}
                                    </td>
                                    <td>{{num.db_ip}}</td>
                                    <td>{{num.backup_time|date:"Y-m-d H:i:s"}}</td>
                                    <td >
                                        <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: {{num.status}}">{{num.status}}</div>
                                    </td>
                                    <td>{{num.log}}</td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
        {
        xmlhttp=new XMLHttpRequest();
        }
else
        {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
xmlhttp.onreadystatechange=function()
        {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
                {
                document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
                }
        }
xmlhttp.open("GET","/inc/backup_process/?project={{project}}&action=1&platform={{platform}}",true);
xmlhttp.send()
}
</script>
<SCRIPT LANGUAGE="JavaScript">
function CountDown()
{
        loadXMLDoc();
        // document.getElementById("txtHint").innerHTML=loadXMLDoc();
        // console.log(document.getElementById("txtHint").innerHTML);

}
 timer = setInterval("CountDown()",5000);
</SCRIPT>

{% endblock %}